package com.coldchain.cys.api;

import com.coldchain.authclient.annotation.CheckUserToken;
import com.coldchain.common.msg.BaseResponse;
import com.coldchain.common.msg.ObjectRestResponse;
import com.coldchain.cys.entity.CysCashLog;
import com.coldchain.cys.mapping.ApiUtils;
import com.coldchain.cys.page.CysCashLogQueryVo;
import com.coldchain.cys.service.ICysCashLogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

import java.math.BigDecimal;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author tianpeng
 * @since 2018-09-04
 */
@RestController
@CheckUserToken
@Api(description="承运商提现模块")
public class CysCashLogController {

	@Autowired
	private ICysCashLogService cysCashLogService ;
	
	@ApiOperation(value="承运商提现记录列表")
	@ApiImplicitParams(value={
			@ApiImplicitParam(name="current",value="页码",dataType="Integer",paramType="query"),
			@ApiImplicitParam(name="cid",value="承运商id",dataType="Long",paramType="query"),
	})
	@RequestMapping(value=ApiUtils.SHOW_CYS_CASH_LOG_LIST,method= {RequestMethod.GET})
	public ObjectRestResponse<CysCashLogQueryVo> showCysCashLogList(@ApiIgnore CysCashLogQueryVo vo){
		cysCashLogService.getList(vo);
		return new ObjectRestResponse<CysCashLogQueryVo>(vo) ;
	}
	
	@ApiIgnore
	@RequestMapping(value=ApiUtils.DO_ADD_CYS_CASH_LOG,method= {RequestMethod.POST})
	public BaseResponse doAddCysCashLog(BigDecimal cashMoney) {
		return cysCashLogService.doCash(cashMoney) ;
	}
	
	
	@ApiOperation(value="（平台）处理承运商提现")
	@ApiImplicitParams(value={
			@ApiImplicitParam(name="id",value="提现记录id",dataType="Integer",paramType="query"),
			@ApiImplicitParam(name="static",value="提现处理状态码 1审核通过 2审核驳回",dataType="Integer",paramType="query"),
	})
	@RequestMapping(value=ApiUtils.DO_HANDLE_CYS_CASH,method= {RequestMethod.POST})
	public BaseResponse doHandleCysCash(CysCashLog cash) {
		return cysCashLogService.doHandleCash(cash) ;
	}
}
